<{include file="admin/head.html"}>
<link rel="stylesheet" href="<{$smarty.const.__URL__}>plugins/ueditor/themes/default/ueditor.css"/>
<script type="text/javascript">
	URL = "<{$smarty.const.__URL__}>plugins/ueditor/";
</script>
<body id="dndupload_ct">
	<{include file="admin/nav.html"}>
	<div id="content">
		<div id="sidebar">
			<ul>
				<li><a href="product.php?do=product">查看产品</a></li>
				<li><a href="product.php?do=addPro">添加产品</a></li>
			</ul>
		</div>
		<div id="main">
			<h2 id="page_title"><{$pageTitle}></h2>
			<form action="product.php" method="post" enctype="multipart/form-data">
				<table class="form_table">
					<tr>
						<td>产品名称<span class="required">*</span></td>
						<td><input type="text" name="name" value="<{$proinfo.name}>"></td>
					</tr>
					<tr>
						<td>排序</td>
						<td><input type="text" name="order" value="<{$proinfo.order}>"></td>
					</tr>
					<tr>
						<td>简介</td>
						<td><input type="text" name="sub_title" value="<{$proinfo.sub_title}>"></td>
					</tr>					
					<tr>
						<td>价格</td>
						<td><input type="text" name="price" value="<{$proinfo.price}>"></td>
					</tr>
					<tr>
						<td>促销价格</td>
						<td><input type="text" name="sale_price" value="<{$proinfo.sale_price}>"></td>
					</tr>
					<tr>
						<td>购买连接</td>
						<td><input type="text" name="buy_link" value="<{$proinfo.buy_link}>"></td>
					</tr>
					<tr>
						<td>购买人数</td>
						<td><input type="text" name="buy_nums" value="<{$proinfo.buy_nums}>"></td>
					</tr>
					<tr>
						<td>配方</td>
						<td><input type="text" name="material" value="<{$proinfo.material}>"></td>
					</tr>
					<tr>
						<td>适用人群</td>
						<td><input type="text" name="applicable" value="<{$proinfo.applicable}>"></td>
					</tr>
					<tr>
						<td>使用时间</td>
						<td><input type="text" name="usetime" value="<{$proinfo.usetime}>"></td>
					</tr>
					<tr>
						<td>Banner</td>
						<td>							
							<{foreach from=$proPics item=p}>
								<{if $p.type eq 1}>
									<p class="form_line">
									<a href="<{$smarty.const.UPLOAD_URL}>product/<{$p.file}>" class="hasLightbox">查看图片</a>
									<a href="javascript:;" data="{'url':'product.php?do=delProPic&id=<{$p.id}>','to':'product.php?do=editPro&id=<{$proinfo.id}>'}" class="ln_del">删除</a>
									</p>
								<{/if}>
							<{/foreach}>							
							<p class="form_line"><input type="file" name="banner"></p>
						</td>
					</tr>
					<tr>
						<td>产品图片</td>
						<td>
							<div id="upload_list">
								<p><input type="file" name="details[]"></p>
								<p><input type="file" name="details[]"></p>
								<p><input type="button" id="add_upload" value="再加一个文件"></p>
							</div>
							<div id="dnd_upload_list">
								<{foreach from=$proPics item=p}>
									<{if $p.type eq 2}>
										<p>
											<a href="<{$smarty.const.UPLOAD_URL}>product/<{$p.file}>" class="hasLightbox">查看图片</a>
											<a href="javascript:;" data="{'url':'product.php?do=delProPic&id=<{$p.id}>','to':'product.php?do=editPro&id=<{$proinfo.id}>'}" class="ln_del">删除</a>
										</p>
									<{/if}>
								<{/foreach}>	
							</div>
						</td>
					</tr>
					<tr>
						<td valign="middle">介绍</td>
						<td><textarea name="description" id="desc" class="editor"><{$proinfo.description}></textarea></td>
					</tr>
					<tr>
						<td valign="middle">title</td>
						<td><input name="titles" id="titles" value="<{$proinfo.titles}>" style="width:480px;"></td>
					</tr>
					<tr>
						<td valign="middle">keywords</td>
						<td><input name="keywords" id="keywords" value="<{$proinfo.keywords}>" style="width:480px;"></td>
					</tr>
					<tr>
						<td valign="middle">descrition</td>
						<td><input name="descriptions" id="descriptions" value="<{$proinfo.descriptions}>" style="width:480px;"></td>
					</tr> 
				</table>
				<p>
					<input type="submit" value="提交" name="submit">
					<input type="hidden" name="do" value="<{$do}>">
					<input type="hidden" name="id" value="<{$proinfo.id}>">
				</p>
			</form>
		</div>
	</div>
	<!-- <input type="hidden" id="upload_url" value="<{$smarty.const.__URL__}>dndupload.php">
	<script type="text/javascript" src="<{$smarty.const.VAR_URL}>js/dndupload.js"></script> -->
	<script type="text/javascript" src="<{$smarty.const.__URL__}>plugins/ueditor/editor_config.js"></script>
	<script type="text/javascript" src="<{$smarty.const.__URL__}>plugins/ueditor/editor_all_min.js"></script>	
	<{include file="admin/hasLightbox.html"}>
	<script type="text/javascript">
		var editor = new baidu.editor.ui.Editor();
		editor.render("desc");
		function successCallback(){

		}
		$(document).ready(function(){
			$("#add_upload").click(function(){
				$(this).parent().before('<p><input type="file" name="details[]"></p>');
			})
		})
	</script>
</body>
</html>